#luaJIT 2.0.2
luaJIT-source-install:
    file.managed:
        - name: /usr/local/src/LuaJIT-2.0.2.tar.gz
        - source: salt://lua/files/LuaJIT-2.0.2.tar.gz
        - user: root
        - group: root
        - mode: 755
        - unless: test -f /usr/local/src/LuaJIT-2.0.2.tar.gz

    cmd.run:
        - name: cd /usr/local/src && tar -xf LuaJIT-2.0.2.tar.gz && cd LuaJIT-2.0.2 && make 1> /dev/null && make install PREFIX=/usr/local/luajit 1> /dev/null && echo "/usr/local/luajit/lib" > /etc/ld.so.conf.d/usr_local_luajit_lib.conf
        - unless: test -d /usr/local/luajit/


kit-module-install:
    file.managed:
        - name: /usr/local/src/ngx_devel_kit-0.2.19.tar.gz
        - source: salt://lua/files/ngx_devel_kit-0.2.19.tar.gz
        - user: root
        - group: root
        - mode: 755
        - unless: test -f /usr/local/src/ngx_devel_kit-0.2.19.tar.gz

    cmd.run:
        - name: cd /usr/local/src/ && tar -zxf ngx_devel_kit-0.2.19.tar.gz
        - unless: test -d /usr/local/src/ngx_devel_kit-0.2.19

lua-module-install:
    file.managed:
        - name: /usr/local/src/lua-nginx-module-0.9.16.tar.gz
        - source: salt://lua/files/lua-nginx-module-0.9.16.tar.gz
        - user: root
        - group: root
        - mode: 755
        - unless: test -f /usr/local/src/lua-nginx-module-0.9.16.tar.gz

    cmd.run:
        - name: cd /usr/local/src && tar -zxf lua-nginx-module-0.9.16.tar.gz
        - unless: test -d /usr/local/src/lua-nginx-module-0.9.16

cjson-module-install:
    file.managed:
        - name: /usr/local/src/lua-cjson-2.1.0.tar.gz
        - source: salt://lua/files/lua-cjson-2.1.0.tar.gz
        - user: root
        - group: root
        - mode: 755       
        - unless: test -d /usr/local/src/lua-cjson-2.1.0.tar.gz

    cmd.run:
        - name: cd /usr/local/src && tar -zxf lua-cjson-2.1.0.tar.gz && cd lua-cjson-2.1.0 && make 1>/dev/null && make install 1>/dev/null
